home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / CZBindMaker / PrivateSettings / Setting.cs next >
Text File  |  2003-10-10  |  4KB  |  128 lines

  1. /*****************************************************************************
  2.   Copyright ⌐ 2003 by Martin Cook. All rights are reserved. If you like this 
  3.   code then feel free to go ahead and use it. The only thing I ask is that 
  4.   you don't remove or alter my copyright notice. Your use of this software 
  5.   is entirely at your own risk. I make no claims or warrantees about the 
  6.   reliability or fitness of this code for any particular purpose. If you 
  7.   make changes or additions to this code please mark your code as being 
  8.   yours. If you have questions or comments then please contact me at: 
  9.   martinc@outdrs.net
  10.   
  11.   Have Fun! :o)
  12. *****************************************************************************/
  13.  
  14. using System;
  15. using System.ComponentModel;
  16. using System.Collections;
  17. using System.Diagnostics;
  18.  
  19. namespace PrivateSettings
  20. {
  21.     /// <summary>
  22.     /// Represents a runtime application setting.
  23.     /// </summary>
  24.     [DesignTimeVisible(false), ToolboxItem(false)] 
  25.     public class Setting : System.ComponentModel.Component
  26.     {
  27.  
  28.         // *************************************************************************
  29.         // Attributes.
  30.         // *************************************************************************
  31.  
  32.         /// <summary>
  33.         /// Required designer variable.
  34.         /// </summary>
  35.         private System.ComponentModel.Container components = null;
  36.  
  37.         /// <summary>
  38.         /// The storage key for this setting.
  39.         /// </summary>
  40.         private string m_storageKey = "";
  41.  
  42.         /// <summary>
  43.         /// The default value for this setting.
  44.         /// </summary>
  45.         private string m_defaultValue = "";
  46.  
  47.         /// <summary>
  48.         /// The current value of this setting.
  49.         /// </summary>
  50.         private string m_currentValue = "";
  51.  
  52.         // *************************************************************************
  53.         // Properties.
  54.         // *************************************************************************
  55.  
  56.         [Category("Misc")]
  57.         public string StorageKey
  58.         {
  59.             get {return m_storageKey;}
  60.             set {m_storageKey = value;}
  61.         } // End StorageKey
  62.  
  63.         // *************************************************************************
  64.  
  65.         [Category("Misc")]
  66.         public string DefaultValue
  67.         {
  68.             get {return m_defaultValue;}
  69.             
  70.             set 
  71.             {
  72.                 
  73.                 m_defaultValue = value;
  74.  
  75.                 // Should we use the default value?
  76.                 if (m_currentValue.Length == 0)
  77.                     m_currentValue = m_defaultValue;
  78.  
  79.             } // End set
  80.  
  81.         } // End DefaultValue
  82.  
  83.         // *************************************************************************
  84.         
  85.         [Browsable(false)]
  86.         public string CurrentValue
  87.         {
  88.             get {return m_currentValue;}
  89.             set {m_currentValue = value;}
  90.         } // End CurrentValue
  91.  
  92.         // *************************************************************************
  93.         // Constructors.
  94.         // *************************************************************************
  95.  
  96.         public Setting(System.ComponentModel.IContainer container)
  97.         {
  98.             container.Add(this);
  99.             InitializeComponent();
  100.         } // End Setting()
  101.  
  102.         // *************************************************************************
  103.  
  104.         public Setting()
  105.         {
  106.             InitializeComponent();
  107.         } // End Setting()
  108.  
  109.         // *************************************************************************
  110.         // Component Designer generated code.
  111.         // *************************************************************************
  112.  
  113.         #region Component Designer generated code
  114.         /// <summary>
  115.         /// Required method for Designer support - do not modify
  116.         /// the contents of this method with the code editor.
  117.         /// </summary>
  118.         private void InitializeComponent()
  119.         {
  120.             components = new System.ComponentModel.Container();
  121.         }
  122.         #endregion
  123.  
  124.     } // End class Setting
  125.  
  126. } // End namespace PrivateSettings
  127.  
  128.